/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package beans;

import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author havn
 */
public class ShoppingCart {

    private List<Product> items;
    private int CustomerID;

    public ShoppingCart() {
        items = new ArrayList<Product>();
    }

    public void addProduct(Product p) {
        items.add(p);
    }

    public void removeProduct(Product p) {
        items.remove(p);
    }

    public List<Product> getCart() {
        return this.items;
    }

    public int getCount() {
        return items.size();
    }

    public int getTotal() {
        int total = 0;
        for (int i = 0; i < items.size(); i++) {
            total += items.get(i).getPrice();
        }
        return total;
    }

    public int getCustomerId() {
        return CustomerID;
    }

    public void setCustomerId(int id) {
        this.CustomerID = id;
    }
}
